package com.basic

import org.apache.spark.sql.{Dataset, SparkSession}

object RDD2DS {
  def main(args: Array[String]): Unit = {
    val spark: SparkSession = SparkSession
      .builder()
      .master("local[*]")
      .appName("RDD2DS")
      .getOrCreate()
    import spark.implicits._
    //从集合中创建rdd
    val rdd = spark.sparkContext
      .parallelize(Array(User("lisi", 10), User("zs", 20), User("ww", 15)))
    val ds: Dataset[User] = rdd.toDS()
    ds.show()
    spark.close()


  }
}
